<%--
    Document   : newarea
    Created on : Oct 16, 2011, 10:43:32 PM
    Author     : VIC
--%>
<%--
    Tham số hệ thống
newarea  areainfo   areaname   areamsg  save
order    status     action  search
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%@page import="java.util.*,Beans.ThamSoHT,Models.ThamSoHT_Model"%>
<!--
Danh sách các tham số hệ thống ở trang này :
order      areainfo     areamsg     status      arealang
newarea    areaname     save        action      arealist
enable     disable      search
-->
<script type="text/javascript">

</script>
<%
            int langid = (Integer) session.getAttribute("langid"); // ngôn ngữ hiện tại
            String dsts = " 'checksubmitmsg', 'unitexist', 'rightmsg', 'unitinfo', 'unitlist', 'unitmsg', 'unitname', 'unit', 'notice', 'order', 'save' ";
            ThamSoHT[] mdsts = ThamSoHT_Model.DSThamSo(dsts, langid); // mảng chứa các tham số của trang này.
            String checksubmitmsg = mdsts[0].getTenTS();            
            String notice = mdsts[1].getTenTS();
            String order = mdsts[2].getTenTS();
            String rightmsg = mdsts[3].getTenTS();
            String save = mdsts[4].getTenTS();
            String unit = mdsts[5].getTenTS();
            String unitexist = mdsts[6].getTenTS();
            String unitinfo = mdsts[7].getTenTS();
            String unitlist = mdsts[8].getTenTS();
            String unitmsg = mdsts[9].getTenTS();
            String unitname = mdsts[10].getTenTS();

            String msg = notice + "/" + unitexist;
            String msgright = notice + "/" + rightmsg;
            String msgchecksubmit = notice + "/" + checksubmitmsg;
            Vector v = (Vector) request.getAttribute("DSDVT");

            int numpage = 0;// khởi tạo số trang = 0
            int vsize = v.size();
            if (vsize % 6 == 0) // mỗi trang có 6 dòng
            {
                numpage = vsize / 6;
            } else {
                numpage = vsize / 6 + 1;
            }
            String xx = (String) request.getAttribute("item"); // trang hiện tại đang xem
            int item = Integer.parseInt(xx);

%>
<h1><img style="margin-right: 13px; opacity: 0.8; margin-top: 5px;" alt="" src="../images/dvt.png"><%=unit%></h1>
<div class="cb"></div>
<div class="bloc left">
    <div class="title">
        <%=unitinfo%>        
    </div>
        <div class="content" style=" padding-top: 25px;">
        <form name="addDVT" action="">
            <div style="width: 120px; float: left; margin-left: 10px;"><%=unitname%></div>
            <input type="text" style="width: 150px;" class="text" name="dvtname"/>
            <input style="margin-left: 50px" alt="<%=msg%>" class="button" lang="<%=msgright%>" id="<%=msgchecksubmit%>" onclick="CreateDVT(this.alt, this.lang, this.id);" type="button" value="<%=save%>" /><br/><br/><br/>
            <label><%=unitmsg%></label>
        </form>
    </div>
</div>
<div id="DSDVT" class="bloc right" style=" width: 45%; min-height: 153px;">
    <div class="title">
        <%=unitlist%>        
    </div>
    <div class="content">
        <form name="dsdonvitinh" action="">
            <table class="mytable" border="0" cellpadding="0" cellspacing="0">
                <thead>
                    <tr>
                        <th style="width: 10%; padding-left: 30px;  "><%=order%></th>
                        <th style="width: 8%; ">
                            <a href="#" id="titledskv1" style="margin-top: 5px;" class="down" lang="<%=msgright%>"  name="1" onclick="SortTenDVT(this.className, this.name, this.lang)">
                                <div style="float:left"><%=unitname%></div>
                                <div id="sortkv1" style=" margin-right: 100px;" class="down1"></div>
                            </a>
                        </th>                        
                    </tr>
                    <tr id="searchDVT">
                        <th style=" padding-left: 30px;"><img style=" margin-top: 2px; margin-left: 3px; margin-bottom: -7px; cursor: pointer;" lang="<%=msgright%>" alt="1" src="../images/search1.png" onclick="SearchDVT(this.alt, this.lang)"></th>
                        <th><input type="textbox" style=" width: 120px;" class="text" name="TENDVT" ></th>
                    </tr>
                </thead>
                <tbody>
                    <%
                                for (int i = (item - 1) * 6; i < (item - 1) * 6 + 6 && i < vsize; i++) {
                                    Beans.DonViTinh dvt = (Beans.DonViTinh) v.elementAt(i);
                    %>
                    <tr>
                        <td style="padding-left: 40px; "><%= i + 1%></td>
                        <td class="TenKV"><a href="#" name="<%=dvt.getMaDVT()%>" lang="<%=msgright%>" onclick="ShowLangDVT(this.name, this.lang)"><%= dvt.getTenDVT()%></a></td>

                    </tr>
                    <%  }
                    %>
                </tbody>
            </table>
            <div class="pagination" style=" margin-top: 20px;">
                <%
                            int trang = 1;
                            if (item > 1) {
                                trang = item - 1;
                            }
                %>
                <%
                            if (vsize > 6) {%>
                <a href="#" class="prev"  name="<%= trang%>" lang="<%=msgright%>" onclick="Unit( this.name, this.lang)">«</a>
                <%
                                        for (int c = 1; c <= numpage; c++) {
                                            if (c != item) {
                %>              <a href="#"  name="<%= c%>" lang="<%=msgright%>" onclick="Unit( this.name, this.lang)" ><%= c%></a>
                <%          } else {%><a class="current"> <%= c%></a> <% }
                                        }
                %>
                <%      if (item + 1 <= numpage) {
                                            trang = item + 1;
                                        } else {
                                            trang = item;
                                        }
                %>
                <a href="#" class="next"  name="<%= trang%>" lang="<%=msgright%>" onclick="Unit( this.name, this.lang)">»</a>
                <%  }
                %>
            </div>
        </form>
    </div>
</div>
<div id="dvtlang" style=" width: 49%; overflow: hidden; " >
</div>

